package com.github.tifezh.kchart.mock;

import com.google.gson.Gson;

import java.io.IOException;

public class Data {

    public static String getProjectPath() {
        return System.getProperty("user.dir");
    }

    public static BaseInfo baseInfo() {
        String path = getProjectPath();
        String str = readFile(path+"/klineData/hk50.json");

        return new Gson().fromJson(str, BaseInfo.class);
    }

    public static String readFile(String filePath) {
        StringBuffer sb = new StringBuffer();
        try {
            FileUtils.readToBuffer(sb, filePath);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return sb.toString();
    }
}
